<?php


namespace app\miniweb\controller\v1;


use think\Controller;
use think\Env;

class AstroSynastry extends Controller
{

    /**
     * 合盘结果页
     */
    public function getWithScore()
    {
        $data = [
            'score' => [
                'attract' => [
                    'num' => 35,
                    'text' => '落花无情',
                ],
                'chat' => [
                    'num' => 78,
                    'text' => '相谈甚欢',
                ],
                'passion' => [
                    'num' => 44,
                    'text' => '火花四射',
                ],
                'benefit' => [
                    'num' => 78,
                    'text' => '引为知己',
                ],
                'happy' => [
                    'num' => 76,
                    'text' => '其乐融融',
                ],
                'probTobeLover' => [
                    'num' => 100,
                    'text' => '不解之缘',
                ],
            ],
            'harmoniousAndConflict' => [77, 23],
            'relation' => [
                [
                    'per' => 0.74,
                    'name_cn' => '合作伙伴',
                    'name_en' => 'partner',
                ],
                [
                    'per' => 0.71793842438877,
                    'name_cn' => '亲朋好友',
                    'name_en' => 'family',
                ],
                [
                    'per' => 0.57566666666667,
                    'name_cn' => '恋人',
                    'name_en' => 'love',
                ],
                [
                    'per' => 0.54855737704918,
                    'name_cn' => '灵魂伴侣',
                    'name_en' => 'soul',
                ],
                [
                    'per' => 0.52333333333333,
                    'name_cn' => '夫妻',
                    'name_en' => 'cp',
                ],
            ],
            'foothold' => [
                0 => '交流顺畅，谈天说地轻松愉悦',
                1 => '心灵相通，相互理解相互抚慰，可以倾诉心事相互信赖',
                2 => '有金钱物质方面的往来，或者机会的提供、心灵的启示',
                3 => '性情相似、投缘，有默契，容易相互理解',
            ],
            'conflict' => [
                0 => '女神暂时没找到你们相处的问题，那你们很可能相处得非常融洽，请好好珍惜彼此',
            ],
            'score2' => [
                'grow' => 24,
                'substance' => 0,
                'care' => 96,
                'motivate' => 54,
                'relieved' => 100,
                'luck' => 16,
            ],
            'score1' => [
                'grow' => 0,
                'substance' => 100,
                'care' => 100,
                'motivate' => 0,
                'relieved' => 100,
                'luck' => 98.4,
            ],
            'if_love' => '高山流水知音，一生能有几人',
            'if_love_status' => 2,
        ];

        $goodsStr = '[{"title":"专属预测报告","desc":"一次购买、终生免费升级","goods_list":[{"status":0,"bg_img":"\/test\/natal_report\/mini\/large_feelings.png","unlock_num":837,"type":0,"btn_color":"#FF6C89","num_color":"#FF8FAC","num_bg_color":"#FFC6D3","gid":39}]},{"title":"详细运势报告","desc":"一次购买、终生免费升级","goods_list":[{"status":0,"bg_img":"\/mini\/astrolabe\/goods\/type_fortune_month.png?v=52672282","unlock_num":227240,"type":3,"btn_color":"#FA8C00","num_color":"#FA6400","num_bg_color":"#FDCDA3","gid":-1}]},{"title":"深度预测报告","desc":"一次购买、终生免费升级","goods_list":[{"status":0,"bg_img":"\/mini\/astrolabe\/goods\/type_natal_report.png?v=52672282","unlock_num":15226,"type":7,"btn_color":"#44D7B6","num_color":"#44D7B6","num_bg_color":"#BCF0E4","gid":-1}]}]';

        $goodsContent = json_decode($goodsStr, true);

        $score = 0;
        foreach ($data['score'] as $item)
        {
            $score += $item['num'];
        }

        return $this->fetch('astro_synastry/get_with_score', [
            'oss' => Env::get('host.photo'),
            'data' => $data,
            'total_score' => $score,
            'goods_content' => $goodsContent
        ]);
    }
}
